var contaDivs=0;
//$('#idModal').modal();
function alerta (mensagem){
	alert(mensagem);
}



function excluir(pergunta, url){
    if (confirm(pergunta)){
        location.href=url;
    }
}

/*function montar(classe){
    contaDivs+=1;
    document.getElementById("area_editor").innerHTML+="<div id='copia"+classe+contaDivs+"'class='"+classe+"' onmouseover='mostrarDelete("+contaDivs+")' onmouseout='ocultarDelete("+contaDivs+")'><div id='"+contaDivs+"'class='delete' onclick='desfazer(copia"+classe+contaDivs+")'></div><p contenteditable='true'></p></div>";
}*/	

function mostrarDelete(id){
   document.getElementById(id).style.visibility="visible";
}

function ocultarDelete(id){
    document.getElementById(id).style.visibility="hidden";
}

function desfazer(id){
    contaDivs-=1;
    id.parentNode.removeChild(id);
}

function executar(){
	var tempo1;
	var tempo2;
	var x = document.getElementById("area");
	var c="";
	for(i=0;i<x.childElementCount;i++){
	  if(x.childNodes[i].className=='terminal'){
	    c='terminal';
	  }else if(x.childNodes[i].className=='processamento'){
	    c='processamento';}
	    else if(x.childNodes[i].className=='seta'){
	      c='seta';}
	      else if(x.childNodes[i].className=='teclado'){
		c='teclado';}
		else{c='video';}
	
    tempo1=setTimeout("insereClasseExecucao("+i+")",1000);
    tempo2=setTimeout("retiraClasseExecucao("+i+","+c+")",2000);
   }
}

function insereClasseExecucao(contador){
	var x = document.getElementById("area");
	 x.childNodes[contador].className+=" execucao";
}

function retiraClasseExecucao(contador,classe){
  
	var x = document.getElementById("area");
	x.childNodes[contador].className=classe;
}

function limparArea(){
	document.getElementById("area").innerHTML="";
}
   
function conectar(idSource, idTarget){
   jsPlumb.connect({
        source:idSource.toString(),
        target:idTarget.toString(),
        connector:"Straight",
        paintStyle:{
            strokeStyle:"black",
            lineWidth:1
        },
        endpointStyle:{
            fillStyle:"black",
            outlineColor:"black",
            outlineWidth:1
        }
    });
}
   

$(function(){
       $('.elementos').click(function (){
          var div= $(this).clone('click');
          div.removeClass('elementos').addClass('dragglable').appendTo('#area_editor'); 
       })
  });

$(function(){
   $('#terminal').draggable(); 
});
 